package com.upstream.link.view
{
	import com.upstream.link.SYS;
	
	import flash.display.Sprite;
	
	public class RectItem extends Sprite
	{
		public var rectVo:RectVO;
		public function RectItem($vo:RectVO)
		{
			this.rectVo = $vo;
			draw();
		}
		
		private function draw():void{
			var color:uint;
			if(this.rectVo.type == RectVO.COLOR_RED){
				color = 0xff0000;
			}else if(this.rectVo.type == RectVO.COLOR_GREEN){
				color = 0x00ff00;
			}else if(this.rectVo.type == RectVO.COLOR_BLUE){
				color = 0x0000ff;
			}else if(this.rectVo.type == RectVO.COLOR_YELLOW){
				color = 0xffff00;
			}else if(this.rectVo.type == RectVO.COLOR_GREY){
				color = 0x666666;
			}
			
			this.graphics.beginFill(color);
			this.graphics.drawRect(0,0,SYS.ITEM_WIDTH,SYS.ITEM_HEIGHT);
			this.graphics.endFill();
		}
		
		public function changeType():void{
			if(this.rectVo.type != 0){
				this.rectVo.type = 0;
				this.draw();
			}
		}
	}
}